programming4us
           
 
 
SQL Server

SQL server 2008 : Managing Security - Permissions

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
10/24/2010 4:55:52 PM
Designing a permissions strategy is important when properly securing database objects. Considering the hierarchy of securables—a database, a schema, or an object—you have options of applying permissions by either granting permissions on the database, on each schema within the database, or on each individual table or view.

The permissions that can be granted and to which securables they can be applied are as follows:

  • SELECT Synonyms, Tables and columns, Table-valued functions, Transact-SQL and common language runtime (CLR), and columns, Views and columns

  • VIEW CHANGE TRACKING Tables and Schemas

  • UPDATE Synonyms, Tables and columns, Views and columns

  • REFERENCES Scalar and aggregate functions (Transact – SQL and CLR), Service Broker queues, Tables and columns, Table-valued functions (Transact – SQL and CLR), and columns, Views and columns

  • INSERT Synonyms, Tables and columns, Views and columns

  • DELETE Synonyms, Tables and columns, Views and columns

  • EXECUTE Procedures (Transact – SQL and CLR), Scalar and aggregate functions (Transact – SQL and CLR), Synonyms

  • RECEIVE Service Broker queues

  • VIEW DEFINITION Procedures (Transact – SQL and CLR), Service Broker queues, Scalar and aggregate functions (Transact – SQL and CLR), Synonyms, Tables, Table-valued functions (Transact – SQL and CLR), Views

  • ALTER Procedures (Transact – SQL and CLR), Scalar and aggregate functions (Transact SQL and CLR), Service Broker queues, Tables, Table-valued functions (Transact – SQL and CLR), Views

  • TAKE OWNERSHIP Procedures (Transact – SQL and CLR), Scalar and aggregate functions (Transact – SQL and CLR), Synonyms, Tables, Table-valued functions (Transact – SQL and CLR), Views

  • CONTROL Procedures (Transact – SQL and CLR), Scalar and aggregate functions (Transact – SQL and CLR), Service Broker queues, Synonyms, Tables, Table-valued functions (Transact – SQL and CLR), Views

Cross-Database Ownership Chaining

Enabled at the instance level, cross-database ownership enables setting permissions on one database object such as a view which retrieves data from two or more tables, or databases in the same instance. This approach does provide a slight performance increase since permission checks are skipped on subsequent objects in the chain; taking this approach has major implications when managing security.

1. Granting Permissions

You need to add a new login and grant Execute permissions on the AdventureWorks2008 database.

  1. Create a new SQL Server login named Test432 and set the default database to AdventureWorks2008 database.

  2. Create a new database user in the AdventureWorks2008 database, mapping it to the SQL Server login Test432. Do not give the user any permissions.

  3. Execute the following code:

    GRANT EXECUTE ON DATABASE::AdventureWorks2008 TO Test432
  4. Once you see, “Command(s) completed successfully”, user Test432 will have to execute permissions on all the objects in the AdventureWorks2008 database.

  5. To test what you’ve done, log in to SQL as Test432 and run the following code:

    exec dbo.uspGetEmployeeManagers 2

If you do not get an error, your grant worked properly.

Head of the Class...: The Correct Match of Permissions

It can seem like every request brings a new challenge for determining the best match for permissions when adding a new user to a database. When business areas consolidate or the responsibilities or business areas span across multiple business areas such as accounting, where they are often involved in supporting every other business area in an organization, it is necessary to construct a list of permissions requirements before just dropping the user into a role or granting a permission that looks like it might work.

You should always be able to justify the choice that you have made. You may need to explain in significant detail what permissions a user or users have been granted. Taking the time to gain a thorough understanding of the SQL Server security hierarchy will greatly help you not only make the best decisions when designing access, you will have a more secure instance and be able to speak with confidence when answering questions in regard to permissions.


Object Permissions

Modules can be marked with an execution context. This enables the code to be run under a specific security context other than whom or what may be calling it. As long as the appropriate permissions exist for context in which the module is run, users only need to be granted permission to the module. Granting explicit object permissions to the module reference objects for the module’s users is not necessary.

The following arguments are available when specifying an Execution Context:

  • CALLER Statements inside the module are executed in the context of who called the module. Appropriate permissions must be applied to the module being called as well as all objects referenced by the module.

  • SELF Equivalent to EXECUTE AS user_name, the specified user is the person creating or altering the module.

  • OWNER The module is executed in the context of the current module owner or if an owner is not specified on the module then the owner of the schema of the module is used.

  • ‘user_name’ The module is executed in the context of the user specified in user_name.

  • ‘login_name’ The module is executed in the context of the SQL Server login specified in login_name.


Log-in Permissions (As Related to Roles)

Logins can be added to server-level roles which are used to grant server-wide privileges to a user added to any of the fixed server-level roles. It is important to remember to make sure that a user is not being granted more permissions then they need. The server-level roles generally have the ability to perform tasks beyond the scope of users other than a DBA or server administrator.

2. Add a SQL Server Login to a Server-Level Role

You will add a SQL Server login to the db_creator server-level role.

  1. Logged in as sysadmin, Execute the following code (any SQL Server login can be specified that does not already exist in the db_creator role):

    exec sp_addsrvrolemember @loginame= 'test432', @rolename = 'dbcreator'
  2. Verify that the log-in name you specified is now shown as a member of the db_creator server-level role.

Other -----------------
- SQL server 2008 : Managing Security - Schemas
- SQL server 2008 : Managing Security - Users
- SQL server 2008 : Managing Security - Roles
- SQL Server 2008 : Managing Remote Servers
- Linked Servers
- Adding, Dropping, and Configuring Linked Servers
- Mapping Local Logins to Logins on Linked Servers
- Obtaining General Information About Linked Servers
- Executing a Stored Procedure via a Linked Server
- Setting Up Linked Servers Using SQL Server Management Studio
- Encryption basics for SQL Server : Cryptographic Keys
- Encryption basics for SQL Server : Key Maintenance
- Encryption basics for SQL Server : Key Algorithms
- SQL Server 2005 : Performing Database Backups
- SQL Server 2005 : Restoring Data from a Backup
- SQL Server 2005 : Using Database Snapshots
- SQL Server 2005 : Automating Maintenance with Job Scheduling
- Other SQL Server XML Support
- SQL Server 2005 : Managing XML Data (part 2) - The xml Data Type and Methods
- SQL Server 2005 : Managing XML Data (part 1)
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us